package com.chixing.service.impl;

import com.chixing.mapper.TravelNotesMapper;
import com.chixing.pojo.TravelNotes;
import com.chixing.pojo.TravelNotesExample;
import com.chixing.service.CustomerMainService;
import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerMainServiceImpl implements CustomerMainService {
    @Autowired
    private TravelNotesMapper travelNotesMapper;
    @Override
    public ServerResponse getById(Integer custId) {
        TravelNotesExample example = new TravelNotesExample();
        example.createCriteria().andCustIdEqualTo(custId);
        List<TravelNotes> travelNotesList=travelNotesMapper.selectByExample(example);
        List<TravelNotes> travelNotesList1 = travelNotesList.subList(0,2);
        if (travelNotesList.size()>0)
            return ServerResponse.getSuccess(travelNotesList1);
        return ServerResponse.getFail(null);
    }
}
